package com.socialsoftware.Page;

import android.app.Application;
import android.util.Log;

import com.socialsoftware.repository.ContactRepository;
import com.socialsoftware.repository.UserRepository;
import com.socialsoftware.util.SessionManager;

/**
 * Application class for initializing app-wide components.
 * This class is responsible for initializing the database, repositories, and other
 * app-wide components that should be available throughout the application lifecycle.
 */
public class SocialSoftwareApplication extends Application {
    private static final String TAG = "SocialSoftwareApp";
    
    // Declare repositories
    private ContactRepository contactRepository;
    private UserRepository userRepository;
    
    @Override
    public void onCreate() {
        super.onCreate();
        
        Log.d(TAG, "应用初始化，设置基础组件");
        
        // Initialize repositories
        contactRepository = new ContactRepository(this);
        userRepository = new UserRepository(this);
        
        // 注意：多媒体通信服务现在在用户登录时初始化，而不是在应用启动时
        // 对应的代码已移到LoginActivity和MainActivity中
    }
    
    /**
     * Get the contact repository instance
     * @return ContactRepository instance
     */
    public ContactRepository getContactRepository() {
        return contactRepository;
    }
    
    /**
     * Get the user repository instance
     * @return UserRepository instance
     */
    public UserRepository getUserRepository() {
        return userRepository;
    }
} 